﻿using System;
using System.Linq;
using System.Text;

namespace Mysoft.QuickCode.DAL
{
    /// <summary>
    /// 让对象支持Sql扩展方法调用
    /// </summary>
    public sealed class Sqlable
    {
    }

    /// <summary>
    /// Sqlable扩展方法合集
    /// </summary>
    public static class SqlableExtension
    {
        private static Sqlable sqlable = new Sqlable();
        /// <summary>
        /// 让对象属性支持QuickCode的查询条件扩展调用
        /// </summary>
        /// <param name="val"></param>
        /// <returns></returns>
        public static Sqlable Sqlable(this object val)
        {
            return sqlable;
        }

        public static bool In(this Sqlable sqlable, string[] values) { return true; }
        public static bool In(this Sqlable sqlable, Guid[] values) { return true; }

        public static bool NotIn(this Sqlable sqlable, string[] values) { return true; }
        public static bool NotIn(this Sqlable sqlable, Guid[] values) { return true; }



        public static bool Between(this Sqlable sqlable, object left, object right) { return true; }
        public static bool Lt(this Sqlable sqlable, object value) { return true; }
        public static bool Gt(this Sqlable sqlable, object value) { return true; }
        public static bool Le(this Sqlable sqlable, object value) { return true; }
        public static bool Ge(this Sqlable sqlable, object value) { return true; }
        public static bool NotEquals(this Sqlable sqlable, object value) { return true; }
        public static bool IsNull(this Sqlable sqlable) { return true; }
        public static bool IsNotNull(this Sqlable sqlable) { return true; }

        #region InTable 创建临时表，支持SQL语句超长的IN查询，外层需要嵌套事务或使用同一个Connection

        public static bool InTable(this Sqlable sqlable, string[] values) { return true; }
        public static bool InTable(this Sqlable sqlable, Guid[] values) { return true; }


        public static bool NotInTable(this Sqlable sqlable, string[] values) { return true; }
        public static bool NotInTable(this Sqlable sqlable, Guid[] values) { return true; }

        #endregion

    }
}
